<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    var num = 245;

    console.log( num.toString(2) );
    console.log( num.toString(3) );
    console.log( num.toString(4) );
    console.log( num.toString(5) );
    console.log( num.toString(8) );
    console.log( num.toString(10) );
    console.log( num.toString(16) );

    console.log("--------");

    var str = "110111";

    console.log( parseInt(str, 2) );
    console.log( parseInt(str, 3) );
    console.log( parseInt(str, 4) );
    console.log( parseInt(str, 8) );
    console.log( parseInt(str, 10) );
    console.log( parseInt(str, 16) );

    console.log("--------");

    // 中文转其他进制
    console.log("中".charCodeAt().toString(16));

    console.log("--------");

    // 二进制转八进制
    // 先转十进制，再转八进制
    console.log(parseInt("1011011", 2).toString(8));
    

</script>
</html>